
<div class="x_panel">
  <div class="x_content" style="display: block;">
    <!--表格主体内容-->
    <div class="row-fluid">
      <form action="/order/dai.html" method="get">
        <label class="control-label">订单号</label>
        <input type="text" class="form-control-new" name="form[order_no]" value="{if isset($query.order_no)}{$query.order_no}{/if}">

        <label class="control-label">订单状态</label>
        <select  class="form-control-new" name="form[order_status]" >
          <option {if !isset($query.order_status) || $query.order_status==-1}selected="selected"{/if} value="-1">全部</option>
          <option {if isset($query.order_status) && $query.order_status==5}selected="selected"{/if} value="6">代采购订单</option>
          <option {if isset($query.order_status) && $query.order_status==5}selected="selected"{/if} value="7">中经代支付</option>
        </select>


        <label class="control-label">下单时间</label>
        <input type="text"  name="form[start_time]" value="{if isset($query.start_time)}{$query.start_time}{/if}" placeholder="开始时间" id="J_dh_start" class="form-control-new" >
        <input type="text"  name="form[end_time]" value="{if isset($query.end_time)}{$query.end_time}{/if}" placeholder="结束时间" id="J_dh_end" class="form-control-new" >
        <label class="control-label">手机号</label>
        <input type="text" class="form-control-new" name="form[mobile]" value="{if isset($query.mobile)}{$query.mobile}{/if}">
        <label class="control-label">商品编码</label>
        <input type="text" class="form-control-new" name="form[goods_no]" value="{if isset($query.goods_no)}{$query.goods_no}{/if}">
        <label class="control-label">商品名称</label>
        <input type="text" class="form-control-new" name="form[goods_name]" value="{if isset($query.goods_name)}{$query.goods_name}{/if}">
        <button name="submit" value="export" type="submit" class="btn btn-primary" >导出</button>
        <button name="submit" type="submit" class="btn btn-primary" value="search">查询</button>
      </form>
      <br>
      <form action="/order/dai.html" method="post" enctype="multipart/form-data" onsubmit="return check()">
        <input type="file" name="input_file" id="file">
        <button name="submit" value="import" type="submit" class="btn btn-primary" >导入采购订单</button>
      </form>


    </div>
    <br>
    <div class="cont">
      <table class="table table-bordered table-striped">
        <thead>
        <tr>
          <th>用户名</th>
          <th width="100px">订单号</th>
          <th>手机号</th>
          <th width="100px">收货地址</th>
          <th>收货人</th>
          <th>实付金额</th>
          <th>订单状态</th>
          <th>操作</th>
        </tr>
        </thead>
        <tbody>
        {foreach $order.lists as $orderitem}
        <tr>
          <td>{$orderitem.mobile}</td>
          <td>{$orderitem.order_no}</td>
          <td>{$orderitem.consignee_phone}</td>
          <td>{$orderitem.consignee_province}{$orderitem.consignee_city}{$orderitem.consignee_district}{$orderitem.consignee_address}</td>
          <td>{$orderitem.consignee}</td>
          <td>{$orderitem.order_amount}</td>
          <td>
            {if $orderitem.order_status==0}待支付{elseif $orderitem.order_status==1}中经已代付{/if}
          </td>
          <td>
            <div class="x_content">
              <a class="btn btn-primary btn-xs" href="{eval U(['order/order-detail','id'=>$orderitem.order_id])}"> 查看详情</a>
              {if $orderitem.order_status==0}<a class="btn btn-primary btn-xs" href="{$orderitem.url}"> 代付款</a>{/if}
            </div>
          </td>
        </tr>
        {/foreach}
        </tbody>
      </table>
      <!--分页-->
      {Yii::$app->view->render('/com/pager.php',['pager'=>$order.pager])}

    </div>




  </div>
</div>
<script type="text/javascript" src="{$theme}/libs/js/datepicker/bootstrap-datetimepicker.min.js"></script>
<script>
    var startDate = $('#J_dh_start').datetimepicker({
        format: "yyyy-MM-dd",
        autoclose: true,
        todayBtn: true,
        minView: 2,
    })

    var endDate = $('#J_dh_end').datetimepicker({
        format: "yyyy-MM-dd",
        autoclose: true,
        todayBtn: true,
        minView: 2,
    })

    function check() {
        if($('#file').val().length){
            return true;
        }else{
            alert("请选择上传文件");
            return false;
        }
    }

</script>
